Asynchronous loading example

Asynchronous loading example shows how to control the deployment of GPU resources in your Kanzi application.

When you load GPU resources on parallel threads, the deployment of these resources still happens on the main thread. When the loading threads are done parsing and reading the resource data they add a work item to the deployment queue. The main thread processes some of the items from the deployment queue every frame.

When processing a deployment work item, the main thread is blocked. This can result in uneven frame rate. In some cases you want to control how often and how many resources are deployed each frame to achieve smoother frame rate. Application class interface provides a callback which you can override to control the handling of the deployment queue. By default the Application::progressDeploymentTaskOverride funciton deploys one item per frame. You can override this function, and based on your application requirements, deploy fewer or more resources. To deploy a single item from the queue, use the processDeploymentQueueItem function.

You can find the example in the <KanziWorkspace>/Examples/Asynchronous_loading directory:

See also

Examples